Skip to content

Fixed wing throttle rate limiter#11664

Open
breadoven wants to merge 2 commits into
iNavFlight:maintenance-10.xfrom
breadoven:abo_fw_thr_limiter
Open

Fixed wing throttle rate limiter#11664
breadoven wants to merge 2 commits into
iNavFlight:maintenance-10.xfrom
breadoven:abo_fw_thr_limiter

Conversation

@breadoven

Copy link
Copy Markdown
Collaborator

Provides a means of limiting the rate of change of throttle output for fixed wing. Works in both directions, decreasing as well as increasing throttle.

Uses a single setting to define the minimum time in milliseconds for the throttle to change by 1000us, min to max throttle. Setting range = 100 to 10,000. A setting of 100, the default, disables the function.

Testing shows it to work as expected.

Could possibly be used for other platforms but not tested as of yet.

@qodo-code-review

Copy link
Copy Markdown
Contributor

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@github-actions

github-actions Bot commented Jun 20, 2026

Copy link
Copy Markdown

Test firmware build ready — commit 401a9c8

Download firmware for PR #11664

238 targets built. Find your board's .hex file by name on that page (e.g. MATEKF405SE.hex). Files are individually downloadable — no GitHub login required.

Development build for testing only. Use Full Chip Erase when flashing.

@breadoven breadoven added this to the 10.0 milestone Jun 20, 2026
@sensei-hacker

Copy link
Copy Markdown
Member

Cool. I would have guessed that to disable, you'd say it should take at least 0 milliseconds. Zero to disable.
Any intuition behind 100 milliseconds means disabled?

@breadoven

breadoven commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator Author

Cool. I would have guessed that to disable, you'd say it should take at least 0 milliseconds. Zero to disable. Any intuition behind 100 milliseconds means disabled?

Just down to throttleRateLimit being a uint16_t which overflows if the setting is less than something around 15 ms. Given that a setting < 100ms isn't going to have much affect on the throttle, 100ms seemed like a practical minimum to use. You could use a uint32_t instead but why bother when there's no real benefit.

@sensei-hacker

Copy link
Copy Markdown
Member

Just down to throttleRateLimit being a uint16_t which overflows if the setting is less than something around 15 ms.

Oh, smart people stuff. I'm not going to remember that if I ever touch this code, and I'm going to break it.
What would happen if we changed:

static EXTENDED_FASTRAM uint16_t throttleRateLimit = 0;

To:

static EXTENDED_FASTRAM float throttleRateLimit = 0.0f;

Would that do the cast just once rather than casting every time the computation is done?

Don't forget PG version and maybe consider putting the new field at the end for bonus safety, unless putting it in the middle improves alignment.

@breadoven

Copy link
Copy Markdown
Collaborator Author

Would that do the cast just once rather than casting every time the computation is done?

Makes sense, I'll change it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants